package com.netcombine.freewill.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.netcombine.freewill.constants.PageInfo;
import com.netcombine.freewill.manager.SessionManager;

@Controller
public class PageController{

	@RequestMapping(value = "/")
	public String main(HttpSession session){

		if(SessionManager.isLogin(session)){

			return PageInfo.GO_USER;
		}
		else{

			return PageInfo.GO_LOGIN;
		}
	}

	@RequestMapping(value = "/user")
	public String user(HttpSession session){

		if(SessionManager.isLogin(session)){

			return PageInfo.GO_USER;
		}
		else{

			return PageInfo.GO_LOGIN;
		}
	}
	
	@RequestMapping(value = "/member")
	public String member(HttpSession session){

		if(SessionManager.isLogin(session)){

			return PageInfo.GO_MEMBER;
		}
		else{

			return PageInfo.GO_LOGIN;
		}
	}

	@RequestMapping(value = "/community")
	public String community(HttpSession session){

		if(SessionManager.isLogin(session)){

			return PageInfo.GO_COMMUNITY;
		}
		else{

			return PageInfo.GO_LOGIN;
		}
	}

	@RequestMapping(value = "/board")
	public String board(HttpSession session){

		if(SessionManager.isLogin(session)){

			return PageInfo.GO_BOARD;
		}
		else{

			return PageInfo.GO_LOGIN;
		}
	}
}